package com.wmx.yuanyuan.awt;

import org.junit.jupiter.api.Test;

import javax.swing.filechooser.FileSystemView;
import java.io.File;

/**
 * FileSystemView 文件系统视图
 *
 * @author wangMaoXiong
 * @version 1.0
 * @date 2022/1/27 17:11
 */
public class FileSystemViewTest {

    /**
     * FileSystemView getFileSystemView()：获取文件系统视图
     * File getHomeDirectory()：获取桌面文件路径
     * File getDefaultDirectory()：返回文件选择器的用户默认文档目录
     */
    @Test
    public void test() {
        FileSystemView fileSystemView = FileSystemView.getFileSystemView();
        File homeDirectory = fileSystemView.getHomeDirectory();
        File defaultDirectory = fileSystemView.getDefaultDirectory();

        //E:\桌面
        System.out.println(homeDirectory);
        //C:\Users\Think\Documents
        System.out.println(defaultDirectory);
    }

}
